var governmentUrl = '/pvm/government/getGovernmentList';


var empNameCheck = (rule, value, callback) => {
  let userNamereg=/^\S+$/
    if(!userNamereg.test(value)){
      callback(new Error('不允许有空格'))
    }else{
      callback()
    }
};

var ageCheck=(rule,value,callback)=>{
  let ageReg=/^[1-9]\d{0,2}$/
    if(!ageReg.test(value)){
      callback(new Error('长度为1-3的阿拉伯数字,不含有空格'))
    }else{
      callback()
    }

}

var phoneCheck=(rule,value,callback)=>{
  let phoneReg=/^((13[0-9])|(15[^4])|(18[0-9])|(17[0-8])|(147,145))\d{8}$/
    if(!phoneReg.test(value)){
      callback(new Error('手机号码格式不对，请重新输入'))
    }else{
      callback()
    }
}

export const tableOption = {
  "border": true,
  "index": true,
  "indexLabel": "序号",
  "stripe": true,
  "menuAlign": "center",
  "align": "center",
  "column": [
	  {
      "type": "input",
      "label": "员工编号",
      "prop": "id",
      hide: true,
      addDisplay: false,
      editDisabled: true
    },	  {
      "type": "input",
      "label": "员工名称",
      "prop": "empName",
      search: true,
      rules: [{
        required: true,
        message: '请输入员工名称',
        trigger: 'blur'
      },
        {validator: empNameCheck, trigger: 'blur'}
      ],
      span: 24,

    },	  {
      "type": "datetime",
      "label": "出生日期",
      "prop": "birthDay",
  format: 'yyyy-MM-dd',
  valueFormat: 'yyyy-MM-dd',
      rules: [{
        required: true,
        message: '请输入年龄出生日期',
        trigger: 'blur'
      }],
      span: 24,
    },	  {
      "type": "radio",
      "label": "性别",//0为男性,1为女性
      "prop": "gender",
      rules: [{
        required: true,
        message: '请选择性别',
        trigger: 'blur'
      }],
      dicData: [{
        label: '男性',
        value: 0
      }, {
        label: '女性',
        value: 1
      }]
    },	  {
      "type": "input",
      "label": "手机号",
      "prop": "phone",
      rules: [{
        required: true,
        message: '请输入手机号码',
        trigger: 'blur'
      },
        {validator: phoneCheck, trigger: 'blur'}
      ],
      span: 24,
    },	  {
      "type": "select",
      "label": "政府编号",
      "prop": "governmentId",
      formslot: true,
      props: {
        label: 'governmentName',
        value: 'id'
      },
      search:true,
      dicUrl: `${governmentUrl}`,
      rules: [{
        required: true,
        message: '请选择政府',
        trigger: 'change'
      }],

    },	  {
      "type": "input",
      "label": "部门编号",
      "prop": "departmentId",
      formslot: true,
    },	  {
      "type": "input",
      "label": "职位名称",
      "prop": "positionName"
    },	  {
      "type": "input",
      "label": "删除标记",//1为未删除,-1为删除
      "prop": "delFlag",
      hide: true,
      addDisplay: false,
      editDisplay: false,
    },	  {
      "type": "input",
      "label": "创建时间",
      "prop": "createTime",
      hide: true,
      addDisplay: false,
      editDisplay: false,
    },	  {
      "type": "input",
      "label": "创建人",
      "prop": "createUser",
      addDisplay: false,
      editDisplay: false,
    },	  {
      "type": "input",
      "label": "修改时间",
      "prop": "updateTime",
      hide: true,
      addDisplay: false,
      editDisplay: false,
    },	  {
      "type": "input",
      "label": "修改人",
      "prop": "updateUser",
      hide: true,
      addDisplay: false,
      editDisplay: false
    }  ]
}
